//
//  DetailViewController.m
//  SDHuiYuShoping
//
//  Created by luojiao on 2017/5/2.
//  Copyright © 2017年 luojiao. All rights reserved.
//

#import "DetailViewController.h"
#import "JLAdvertisingScrollView.h"//third scrollView
#import "TotalAddressViewController.h"
#import "UIViewController+KNSemiModal.h"//third
#import "SizeViewController.h"



@interface DetailViewController ()<UIScrollViewDelegate,JLAdvertisingScrollViewDelegate>

{
    NSMutableArray *bannerArr;
    UIPageControl *pageControl;
}

@end

@implementation DetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.mainScrollView.contentSize = CGSizeMake(APP_WIDTH, self.headerView.frame.size.height + self.choseView.frame.size.height + self.footerView.frame.size.height + 20);
    bannerArr = [[NSMutableArray alloc] initWithObjects:@"storeImagte",@"storeImagte",@"storeImagte",@"storeImagte", nil];
    [self setBgImage];
    [self creatScrollViewImage];
}

- (void)setBgImage
{
    [self.moreAdressButton setImage:[UIImage imageNamed:@"open_btn"] forState:UIControlStateNormal];
    [self.moreAdressButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -170)];
    
    [self.moreColorButton setImage:[UIImage imageNamed:@"open_btn"] forState:UIControlStateNormal];
    [self.moreColorButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -170)];
    
    [self.goStoreButton setImage:[UIImage imageNamed:@"enter_store_bg"] forState:UIControlStateNormal];
    [self.goStoreButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    [self.goStoreButton setTitle:@"进入店铺" forState:UIControlStateNormal];
    [self.goStoreButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -330, 0, 0)];
    [self.goStoreButton setTitleColor:[FRUtils colorWithHexString:@"323232"] forState:UIControlStateNormal];
    
}

- (void)creatScrollViewImage
{
    //滚动的 scrollView
    JLAdvertisingScrollView *scrollView = [[JLAdvertisingScrollView alloc] initWithFrame:CGRectMake(0, 0, APP_WIDTH, 375)];
    [scrollView setImageNames:bannerArr];
    [self.headerView addSubview:scrollView];
    [scrollView setDelegate:self];
    [scrollView setAutoLoopInterval:5];
    
}


#pragma mrak - buttonClick

- (IBAction)moreColorButton:(id)sender
{
    SizeViewController *sizeViewController = [[SizeViewController alloc] init];
    [self.navigationController presentSemiViewController:sizeViewController withOptions:@{KNSemiModalOptionKeys.pushParentBack    : @(NO),KNSemiModalOptionKeys.animationDuration : @(0.6),KNSemiModalOptionKeys.shadowOpacity     : @(0.8)}];
} 

- (IBAction)moreAdressButton:(id)sender
{
    //用于推出选择地址页面
   TotalAddressViewController *addressViewController = [[TotalAddressViewController alloc] init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:addressViewController];
    nav.view.frame = CGRectMake(0, self.view.frame.size.height - 400, self.view.frame.size.width, 400);
    
    [self.navigationController presentSemiViewController:nav withOptions:@{KNSemiModalOptionKeys.pushParentBack    : @(NO),KNSemiModalOptionKeys.animationDuration : @(0.6),KNSemiModalOptionKeys.shadowOpacity     : @(0.8)}];
    
}
- (IBAction)goStroreButton:(id)sender
{
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
